//
//  oldRechargeViewController.m
//  laonianbang
//
//  Created by 勇拓 李 on 18/3/29.
//  Copyright © 2018年 zaiyou. All rights reserved.
//

#import "oldRechargeViewController.h"
#import "oldPayView.h"
#import "oldBalance.h"

@interface oldRechargeViewController ()<oldPayViewDelegate>
@property (weak, nonatomic) IBOutlet UITextField *text_filed;
@property (weak, nonatomic) IBOutlet UIButton *btn_recharge;

@end

@implementation oldRechargeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initView];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - initView
- (void)initView
{
    self.navigationItem.title = @"充值";
    
    _btn_recharge.layer.cornerRadius = 6.f;
    [_btn_recharge addTarget:self action:@selector(btn_recharge_tapped:) forControlEvents:UIControlEventTouchDown];
}

- (void)btn_recharge_tapped:(id)sender
{
    oldPayView *view = [[[NSBundle mainBundle] loadNibNamed:@"oldPayView"
                                                      owner:self
                                                    options:nil] objectAtIndex:0];
    view.price = _text_filed.text;
    view.recharge = YES;
    view.delegate = self;
}

#pragma mark - delegate
- (void)paySuccess
{
    
    WeakSelf
    
    [BALANCE_SINGLETON requestBalanceSuccess:^(id data) {
        [weakSelf.navigationController popViewControllerAnimated:YES];
    } error:^(NSString *error) {
        [oldHub warningWindow:error];
    }];
}

@end
